package com.example.controller;

import com.example.entity.Myorder;
import com.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyorderController {
    @Autowired
    OrderService service;
    @Value("${server.port}")
    String serverPort;
    @GetMapping("order/{orderId}")
    public String getbyOrdId(@PathVariable("orderId") Integer orderId){
        return serverPort+"正在访问"+service.getOrderById(orderId);
    }
    @PostMapping("order/insertOrd")
    public String getAllOrd(Integer custId,Integer proId){
        return serverPort+"正在访问,添加功能"+service.insertOrder(custId,proId);
    }
}
